<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" id="input">
    <h1></h1>
    <ul id="ul"></ul>
    <script>
        var input = document.getElementById("input");
        var ul = document.getElementById("ul");
        var arr = [];
        input.onkeydown = function(event){
            console.log(event.keyCode);
            if(event.keyCode==13){
                if(arr.indexOf(this.value)==-1&&this.value!=""){
                    arr.push(this.value);
                    var li = document.createElement("li");
                    li.innerHTML = this.value;
                    ul.appendChild(li)
                }
            }
        }
    </script>
</body>
</html>